
pub struct Rectangle {
    width: u32,
    height: u32
    
}

impl Rectangle{
    pub fn new(width: u32, height: u32) -> Self {
        Rectangle { width, height }
    }
    pub fn width(&self) -> u32 {
        return self.width;
    }  
    pub fn area(&self) -> u32 {
        self.width * self.height
    }    
}

fn main() {
    // println!("Hello, world!");
    let rect1 = Rectangle { width:40,height:30 };

    print!("The area of rectangle is {} square pixels.", rect1.area());
    print!("The width1 property of rectangle is {} pixels.", rect1.width);
    print!("The width2 fun of rectangle is {} pixels.", rect1.width());

    let rect2 = Rectangle::new(140,130);

    print!("The area of rectangle is {} square pixels.", rect2.area());
    print!("The width1 property of rectangle is {} pixels.", rect2.width);
    print!("The width2 fun of rectangle is {} pixels.", rect2.width());
}
